﻿
using Senparc.Weixin.QY.AdvancedAPIs.Mass;
using Senparc.Weixin.QY.CommonAPIs;
using Senparc.Weixin.QY.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using SZHL.Data;
using SZHL.UI.AppCode;

namespace SZHL.UI.View
{
    public partial class ZHBG_QYGG : FormUControl
    {




        #region//添加页面

        public override void initAddForm(string strFormCode)
        {
            conZDSDate.Value = DateTime.Now.ToString("yyyy-MM-dd");
            conZDEDate.Value = DateTime.Now.AddDays(7).ToString("yyyy-MM-dd");
        }


        public override bool SaveForm(int intFormID, string strActionType, int intProcessInstanceID = 0)
        {
            base.SaveForm(intFormID, strActionType, intProcessInstanceID);

            ZH_XTGG MODEL = new ZH_XTGG();
            MODEL = new ZH_XTGGB().GetEntity(d => d.ID == intFormID);
            MODEL.GGTitle = conGGTitle.Text;
            MODEL.remark = conISZY.SelectedValue;
            MODEL.remark1 = hidRY.Value;
            MODEL.remark2 = conRY.Text;
            MODEL.ZDSTime = DateTime.Parse(conZDSDate.Value);
            MODEL.ZDETime = DateTime.Parse(conZDEDate.Value);
            MODEL.GGContent = conGGContent.Text;
            MODEL.Files = conFiles.Text;
            
           
            return new ZH_XTGGB().Update(MODEL);
        }





        #endregion

        #region//查看页面
        /// <summary>
        /// 初始化View页面
        /// </summary>
        /// <param name="intFormID">表单号</param>
        public override void initMangerForm(int intFormID,string strAction)
        {
            ZH_XTGG MODEL = new ZH_XTGG();
            MODEL = new ZH_XTGGB().GetEntity(d => d.ID == intFormID);
            conGGTitle.Text = MODEL.GGTitle;
            conZDSDate.Value = DateTime.Parse(MODEL.ZDSTime.ToString()).ToString("yyyy-MM-dd");
            conZDEDate.Value = DateTime.Parse(MODEL.ZDETime.ToString()).ToString("yyyy-MM-dd");
            conGGContent.Text = MODEL.GGContent;
            conISZY.SelectedValue = MODEL.remark;
            hidRY.Value = MODEL.remark1;
            conRY.Text = MODEL.remark2;
            conFiles.Text = MODEL.Files;
            if (strAction == "VIEW")
            {
                conFiles.Attributes.Add("UploadType", "1");
            }
        }

        #endregion





    }
}